/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.chart.AChartParam;
import com.thor.palmmall.spi.chart.SChartParam;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SChartParamConverter implements Converter<AChartParam, SChartParam> {

  public static SChartParamConverter getInstance() {
    if (instance == null)
      instance = new SChartParamConverter();
    return instance;
  }

  private static SChartParamConverter instance;

  private SChartParamConverter() {
  }

  @Override
  public SChartParam convert(AChartParam source) {
    if (source == null) {
      return null;
    }
    SChartParam target = new SChartParam();
    target.setDateRange(SDateRangeConverter.getInstance().convert(source.getDateRange()));
    target.setStore(source.getStore());
    return target;
  }

}
